package com.greensecurity.sim.util;

import cn.hutool.core.io.FileUtil;

public class IsWindowOrLinuxUtils {
    private static final String WindowFileSavePath = "E:/Green Security";
    private static final String LinuxFileSavePath = "/application/Green Security";
    private static final String ImageSavePath = "/Image";
    private static final String PhotoDistinguishPath = "/PhotoDistinguish";
    private static final String GreenLandImageSavePath = "/green land";
    private static final String OS = System.getProperty("os.name").toLowerCase();
    public static String getPhotoDistinguishPath(){
        String PDSavePath="";
        if (OS.startsWith("win")) {
            PDSavePath=WindowFileSavePath+PhotoDistinguishPath;
        }else {
            PDSavePath=LinuxFileSavePath+PhotoDistinguishPath;
        }
        if (!FileUtil.exist(PDSavePath)){
            FileUtil.mkdir(PDSavePath);
        }
        return PDSavePath;
    }

    public static String getUserImageSavePath(){
        String FileSavePath="";
        if (OS.startsWith("win")) {
            FileSavePath=WindowFileSavePath+ImageSavePath+"/userPhoto";
        }else {
            FileSavePath=LinuxFileSavePath+ImageSavePath+"/userPhoto";
        }
        if (!FileUtil.exist(FileSavePath)){
            FileUtil.mkdir(FileSavePath);
        }
        return FileSavePath;
    }
    public static String savaUserPhotoUrl(){return "/Green Security/Image/userPhoto";}
    public static String saveGreenLandPhotoUrl(){return "/Green Security/Image/green land";}
    public static String savePhotoDisUrl(){return "/Green Security"+PhotoDistinguishPath;}

    public static String getGreenLandImageSavePath(){
        String FileSavePath="";
        if (OS.startsWith("win")) {
            FileSavePath=WindowFileSavePath+ImageSavePath+GreenLandImageSavePath;
        }else {
            FileSavePath=LinuxFileSavePath+ImageSavePath+GreenLandImageSavePath;
        }
        if (!FileUtil.exist(FileSavePath)){
            FileUtil.mkdir(FileSavePath);
        }
        return FileSavePath;
    }

    public static  String  getPhotoUrl(){
        String FileSavePath="";
        if (OS.startsWith("win")) {
            FileSavePath="http://localhost:8080";
        }else {
            FileSavePath="http://1.117.171.162:8080";
        }
        return FileSavePath;
    }
    public static  String  getSaveWinOrLinux(){
        String FileSavePath="";
        if (OS.startsWith("win")) {
            FileSavePath="E:";
        }else {
            FileSavePath="/application";
        }
        return FileSavePath;
    }
}
